<%-- 
    Document   : class-manage
    Created on : Feb 14, 2012, 10:42:23 AM
    Author     : PhucAn
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>


<script type="text/javascript">
    function select(idx){     
        document.getElementById("selected-id").value=idx;
        document.forms[0].action="ClassAction.do?method=select";
        document.forms[0].submit();
    }
    function setValue(idx){
        document.getElementById("selected-id").value=idx;
    }
</script>
<h1>Hello</h1>
<form action="ClassAction.do?method=delete" method="post">

    <table class="data-table">
        <tr>
            <th>Class name</th>
            <th>Created date</th>
            <th>Public</th>
            <th>Created by</th>
            <th></th>
        </tr>
        <c:forEach  var="cls" items="${list}">
            <tr>
                <td>${cls.name}</td>
                <td>${cls.createdDate}</td>
                <td></td>
                <td></td>
                <td>
                    <a href="ClassAction.do?action=modify&classid=${cls.id}">Edit</a> | 
                    <a href="javascript:showConfirm();" onclick="setValue(${cls.id});">Delete</a> - 
                    <a href="javascript:select(${cls.id})">Select</a>
                </td>                    
            </tr>
        </c:forEach>
    </table>
    <div class="confirm-box">
        <div>Are you sure want to continue?</div>
        <input type="submit" name="delete" value="Delete"/>
        <input type="button" name="hide" value="Hide" onclick="hideConfirm();"/>
    </div>
    <input type="hidden" id="selected-id" name="selected-id"/>
</form>
<a href="ClassAction.do?method=add">+ Add new class ...</a>
